package com.wangyg.breadstore.outer;

import com.wangyg.breadstore.model.FlourFactory;
import feign.hystrix.FallbackFactory;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Created by wangyg6 on 2019/5/21 10:36.
 * 原理为创建一个新的接口实现类，里面为具体实现。然后熔断时，调用其中对应的方法
 */
public class FlourFactoryFallback implements FallbackFactory<ICallFlourFactory> {

	@Override
	public ICallFlourFactory create(Throwable cause) {
		return new ICallFlourFactory() {
			@Override
			public FlourFactory crateFactory(@RequestBody FlourFactory flourFactory) {
				return null;
			}

			@Override
			public Integer getFlourNum(@RequestParam("factId") Integer factId) {
				return null;
			}
		};
	}
}
